<template>
	<yd-layout id='wallet' class=''>
		<div class="header">
			<div class="header_list">
				<div class="header_list_title">零钱余额</div>
				<div class="header_list_money">{{dataObj.money}}</div>
				<div class="header_list_btn" @click="goNext('pay')">充值</div>
			</div>
			<span></span>
			<div class="header_list header_list_2">
				<div class="header_list_title">可提现收入</div>
				<div class="header_list_money">{{dataObj.tradeable_money}}</div>
				<div class="header_list_btn header_list_btn_2"  @click="goNext('moneyWithdraw')">提现</div>
			</div>
			<!--<div class="header_ye_title c_size_30_42">零钱余额</div>
			<div class="header_ye_money">{{dataObj.money||'0.0'}}</div>
			<div class="header_sr_title c_size_30_42">直播礼物收入</div> 
			<div class="header_sr_money">{{dataObj.tradeable_money||'0.0'}}</div>
			<div class="header_btn c_size_30_42" @click="goNext('pay')">充值</div>-->
		</div>
		<div class="list">
			<div class="list_item" @click="goNext('moneyDetail',0)">
				<div class="c_size_34_48" >充值明细</div>
				<i class="i"></i>
			</div>
			<div class="list_item" @click="goNext('moneyDetail',1)">
				<div class="c_size_34_48">消费明细</div>
				<i class="i"></i>
			</div>
			<div class="list_item" @click="goNext('moneyDetail',2)">
				<div class="c_size_34_48">收入明细</div>
				<i class="i"></i>
			</div>
			<div class="list_item" @click="goNext('moneyDetail',3)">
				<div class="c_size_34_48">提现明细</div>
				<i class="i"></i>
			</div>
		</div>
		<div @click="$router.push({name:'msgDetail'})" class="detail_money">详细了解零钱及收入</div>
	</yd-layout>
</template>

<script>
	export default{
		components:{
			
		},
		data(){
			return {
				dataObj:{}
			}
		},
		created() {
		},
		watch: {
			
		},
		computed: {
			
		},
		mounted(){
			document.title='钱包'
			this.$root.ajax({
				name:'my',
				type:'get',
				params:{
					
				}
			}).then((d)=>{
				d.data.newTime = this.$root.getDate(new Date(d.datamber_exp*1000))
				d.data.money=this.setMoneyZero(d.data,'money')
				d.data.tradeable_money=this.setMoneyZero(d.data,'tradeable_money')
				this.dataObj=Object.assign({},this.dataObj,d.data)
			})
		},
		methods:{
			//处理金钱的0
			setMoneyZero(obj,str){
				if(obj[str]||obj[str]===0){
					if((obj[str]+'').indexOf('.')>=0){
						return obj[str]=obj[str].toFixed(1)
					}else{
						return obj[str] = obj[str] + '.0'
					}
				}
			},
			goNext(str,num){
				this.$router.push({
					name:str,
					query:{
						type:num
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	@import './wallet.scss';
</style>